package br.com.membros.service;

import java.util.List;

import javax.inject.Inject;
import javax.inject.Named;

import org.apache.log4j.Logger;

import br.com.membros.utils.database.beans.AgendaBean;
import br.com.membros.utils.database.beans.ControleBean;
import br.com.membros.utils.database.beans.MembroBean;
import br.com.membros.utils.database.beans.SalaBean;
import br.com.membros.utils.database.beans.UsuarioBean;
import br.com.membros.utils.database.interfaces.IAgendaService;
import br.com.membros.utils.database.interfaces.IControleService;
import br.com.membros.utils.database.interfaces.IMembroService;
import br.com.membros.utils.database.interfaces.ISalaService;
import br.com.membros.utils.database.interfaces.IUsuarioService;
import br.com.membros.utils.service.interfaces.IServices;

@Named
public class Services implements IServices {

	private final Logger logger = Logger.getLogger(getClass());

	@Inject
	private IAgendaService agendaService;

	@Inject
	private IControleService controleService;
	
	@Inject
	private IMembroService membroService;
	
	@Inject
	private ISalaService salaService;
	
	@Inject
	private IUsuarioService usuarioService;

	
	@Override
	public List<AgendaBean> findAllAgenda() {
		logger.debug("Service Invoked - findAllAgenda");		
		return agendaService.findAll();
	}

	@Override
	public List<ControleBean> findAllControle() {
		logger.debug("Service Invoked - findAllControle");		
		return controleService.findAll();
	}

	@Override
	public List<MembroBean> findAllMembro() {
		logger.debug("Service Invoked - findAllMembro");		
		return membroService.findAll();
	}

	@Override
	public List<SalaBean> findAllSala() {
		logger.debug("Service Invoked - findAllSalas");		
		return salaService.findAll();
	}

	@Override
	public List<UsuarioBean> findAllUsuario() {
		return usuarioService.findAll();
	}

	@Override
	public AgendaBean findAgendaByID(Long id) {
		return agendaService.findById(id);
	}

	@Override
	public ControleBean findControleByID(Long id) {
		return controleService.findById(id);
	}

	@Override
	public MembroBean findMembroByID(Long id) {
		return membroService.findById(id);
	}

	@Override
	public SalaBean findSalaByID(Long id) {
		return salaService.findById(id);
	}

	@Override
	public UsuarioBean findUsuarioByID(Long id) {
		return usuarioService.findById(id);
	}

	@Override
	public Long insertAgenda(AgendaBean bean) {
		return agendaService.insert(bean);
	}

	@Override
	public Long insertControle(ControleBean bean) {
		return controleService.insert(bean);
	}

	@Override
	public Long insertMembro(MembroBean bean) {
		return membroService.insert(bean);
	}

	@Override
	public Long insertSala(SalaBean bean) {
		return salaService.insert(bean);
	}

	@Override
	public Long insertUsuario(UsuarioBean bean) {
		return usuarioService.insert(bean);
	}

	@Override
	public void updateAgenda(AgendaBean bean) {
		agendaService.update(bean);	
	}

	@Override
	public void updateControle(ControleBean bean) {
		controleService.update(bean);
	}

	@Override
	public void updateMembro(MembroBean bean) {
		membroService.update(bean);
	}

	@Override
	public void updateSala(SalaBean bean) {
		salaService.update(bean);
	}

	@Override
	public void updateUsuario(UsuarioBean bean) {
		usuarioService.update(bean);
	}

	@Override
	public void deleteAgenda(AgendaBean bean) {
		agendaService.delete(bean);
	}

	@Override
	public void deleteControle(ControleBean bean) {
		controleService.delete(bean);
	}

	@Override
	public void deleteMembro(MembroBean bean) {
		membroService.delete(bean);		
	}

	@Override
	public void deleteSala(SalaBean bean) {
		salaService.delete(bean);		
	}

	@Override
	public void deleteUsuario(UsuarioBean bean) {
		usuarioService.delete(bean);		
	}

	@Override
	public List<SalaBean> testService() {
		return salaService.findAll();
	}

}